package com.jdbcUtil;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class jdbcUtil {

	Connection conn = null;
	public Connection getConnection() throws SQLException{
		try {
			Class.forName("com.mysql.jdbc.Driver");
			String url="jdbc:mysql://localhost:3306/exam?useUnicode=true&characterEncoding=UTF-8";
			String user="root";
			String pwd = "123456";
			conn = DriverManager.getConnection(url,user,pwd);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return conn;
		
	}
	
	public void close() throws SQLException{
		conn.close();
	}
	
	
	
}
